# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=libblastrampoline
pkgver=5.1.0
pkgrel=0
pkgdesc="Using PLT trampolines to provide a BLAS and LAPACK demuxing library"
url="https://github.com/JuliaLinearAlgebra/libblastrampoline"
# x86: TEXTREL
# others: not supported by upstream
arch="aarch64 armv7 x86_64"
license="MIT"
makedepends="linux-headers"
subpackages="$pkgname-dev"
source="https://github.com/JuliaLinearAlgebra/libblastrampoline/archive/v$pkgver/libblastrampoline-$pkgver.tar.gz"
options="!check"  # tests require nightly julia

_arch=$CARCH
case "$CARCH" in
	armv7) _arch='arm';;
esac

build() {
	make -C src ARCH="$_arch" CFLAGS="${CFLAGS/-Os/}"
}

package() {
	make -C src install ARCH="$_arch" prefix="$pkgdir/usr"

	cd "$pkgdir"
	find usr/include/libblastrampoline/*LP64 \
		-type d -mindepth 1 ! -name "$_arch*-linux-musl*" ! -name common \
		-exec rm -vrf {} +
}

sha512sums="
ccba0b22bd9280f3b2634e71b105ed34f75e591ab6517115ebc174a701c61d60fac90a180b9daed0e60717c00e64756a9a8ad9ab0756485f6277ce5b3e17a800  libblastrampoline-5.1.0.tar.gz
"
